//
//  GDArmImageCollectionViewCell.m
//  Gunterapple
//
//  Created by 热带雨林 on 2021/1/31.
//  Copyright © 2021 热带雨林. All rights reserved.
//

#import "GDArmImageCollectionViewCell.h"
#import "armImageModel.h"
@interface GDArmImageCollectionViewCell ()
@property (nonatomic, strong) UIImageView *imaView;
@property (nonatomic, strong) UILabel *titleLabel;
@property (nonatomic, strong) colorChangeWithImageTool *colorTool;
@end
@implementation GDArmImageCollectionViewCell
- (instancetype)initWithFrame:(CGRect)frame{
    if(self = [super initWithFrame:frame]){
        [self setUpUI];
    }
    return self;
}
- (void)setUpUI{
//    self.contentView.backgroundColor = [UIColor redColor];
    self.imaView = [[UIImageView alloc]initWithFrame:CGRectZero];
    [self.contentView addSubview:self.imaView];
    self.imaView.layer.cornerRadius = 10.0f;
    self.imaView.layer.masksToBounds = YES;
    self.imaView.contentMode = UIViewContentModeScaleToFill;
    self.imaView.clipsToBounds = YES;
    UIEdgeInsets padding = UIEdgeInsetsMake(3, 3, 3, 3);
    [self.imaView mas_makeConstraints:^(MASConstraintMaker *make) {
        make.edges.equalTo(self.contentView).insets(padding);
    }];
    
//    self.titleLabel = [[UILabel alloc]init];
//    [self.contentView addSubview:self.titleLabel];
//    self.titleLabel.font = [UIFont fontWithName:@"Helvetica-Bold" size:20];
//    self.titleLabel.textColor = [UIColor whiteColor];
//    self.titleLabel.numberOfLines = 0;
//    [self.titleLabel mas_makeConstraints:^(MASConstraintMaker *make) {
//        make.left.equalTo(self.contentView).offset(15);
//        make.right.equalTo(self.contentView.mas_right).offset(-5);
//        make.bottom.equalTo(self.contentView.mas_bottom).offset(-15);
//    }];
    /**
     根据图片的背景色设置文字颜色
     */
//    self.colorTool = [[colorChangeWithImageTool alloc]init];
    
}
- (void)setModel:(armImageModel *)model{
    _model = model;
    self.imaView.image = [UIImage imageNamed:model.name];
    self.titleLabel.text = model.title;
//    [self.colorTool setTextColor:self.imaView whith:self.titleLabel];
}

@end
